import QtQuick 2.15
import QtQuick.Window 2.12
import QtQuick.Controls 2.15

Window {
    id: window
    width: 640
    height: 480
    visible: true

    //附加信号onCompleted  onDestruction
    Rectangle {
        id: rect
        anchors.fill: parent
        color: 'green'

        Component.onCompleted: {
            //构造完成
            console.log("Rectangle onCompleted")
        }

        Component.onDestruction: {
            //销毁
            console.log("Rectangle onDestructiond")
        }

        //附加属性Attached Properities
        Flickable {
            anchors.fill: parent
            contentWidth: image.width; contentHeight: image.height
            Image {
                id: image
                source: "test.png"
            }

            ScrollBar.vertical: ScrollBar {}
            ScrollBar.horizontal: ScrollBar {}
        }
    }

    Component.onCompleted: {
        //构造完成
        console.log("Window onCompleted")
    }
}
